name: Build info
description: Sets common builds variables that are needed for other build steps

inputs:
  force-canary:
    description: |
      Forces the current build to be canary.
      Canary builds test all Python versions and do not use constraints.
    required: false
    default: "false"

outputs:
  PYTHON_VERSIONS:
    description: |
      Python versions for which tests will be run.
      The oldest version is replaced by the literal "min" and
      the newest is replaced by the literal "max".
    value: ${{ steps.build_info.outputs.PYTHON_VERSIONS }}
  PYTHON_MIN_VERSION:
    description: Oldest version of Python supported by Streamlit
    value: ${{ steps.build_info.outputs.PYTHON_MIN_VERSION }}
  PYTHON_MAX_VERSION:
    description: Latest version of Python supported by Streamlit
    value: ${{ steps.build_info.outputs.PYTHON_MAX_VERSION }}
  USE_CONSTRAINTS_FILE:
    description: Whether to use a constraint file to install Python dependencies
    value: ${{ steps.build_info.outputs.USE_CONSTRAINTS_FILE }}

runs:
  using: composite
  steps:
    - name: Set Python version vars
      id: build_info
      run: ./.github/scripts/build_info.py
      env:
        GITHUB_CONTEXT: ${{ toJson(github) }}
        GITHUB_INPUTS: ${{ toJson(inputs) }}
      shell: bash --login -eo pipefail {0}
